#include "C_DlgUserLogIn.h"

const char* DefaultAccount = "gisyzk@qq.com";
const char* DafaultPassword = "yang3252348";

C_DlgUserLogIn::C_DlgUserLogIn(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	connect(ui.pushButton_ok,SIGNAL(clicked()),this,SLOT(onOk()));
	connect(ui.pushButton_cancel,SIGNAL(clicked()),this,SLOT(onCancel()));
	connect(ui.checkBox_default,SIGNAL(stateChanged(int)),this,SLOT(onSetDefaultAccount(int)));
}

C_DlgUserLogIn::~C_DlgUserLogIn()
{

}

QString C_DlgUserLogIn::getUserAccount()
{
	return ui.lineEdit_account->text();
}

QString C_DlgUserLogIn::getUserPassword()
{
	return ui.lineEdit_password->text();
}

void C_DlgUserLogIn::onOk()
{
	accept();
}

void C_DlgUserLogIn::onCancel()
{
	reject();
}

void C_DlgUserLogIn::onSetDefaultAccount( int state )
{
	if(state == Qt::Checked)
	{
		ui.lineEdit_account->setText(QString(DefaultAccount));
		ui.lineEdit_password->setText(QString(DafaultPassword));
	}
	else
	{
		ui.lineEdit_account->setText("");
		ui.lineEdit_password->setText("");
	}
}
